<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" /> 
	<title>payment</title>
	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script type="text/javascript" src="https://cdn.bootcss.com/jquery/1.12.2/jquery.js"></script>
<script>
var WXPayment = function() {
    if( typeof WeixinJSBridge === 'undefined' ) {
        alert('请在微信在打开页面！');
        return false;
    }

    $.getJSON("http://www.nbpipixia.cn/payment",function(jsApiParameters){
    	if(jsApiParameters ){
    		//beg
    		 WeixinJSBridge.invoke('getBrandWCPayRequest', jsApiParameters , function(res) {
			        switch(res.err_msg) {
			            case 'get_brand_wcpay_request:cancel':
			                alert('用户取消支付！');
			                break;
			            case 'get_brand_wcpay_request:fail':
			                alert('支付失败！（'+res.err_desc+'）');
			                break;
			            case 'get_brand_wcpay_request:ok':
			                alert('支付成功！');
			                break;
			            default:
			                alert(JSON.stringify(res));
			                break;
			        }
			    });
    		//end



    	}
    })

   
}
</script>
</head>
<body>
<div style="margin-top: 100px;"></div>
<button type="button" onclick="WXPayment()">
支付 ￥ 100 元</button>
</body>
</html>